package com.kgc.library.libraryuserweb.controller;

import com.kgc.library.bean.Bookmanage;
import com.kgc.library.libraryuserweb.util.ResultEntity;
import com.kgc.library.service.BookmanageService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author shkstart
 * @create 2020-09-30 9:32
 */
@RestController
public class BookmanageController {

    @Reference
    BookmanageService bookmanageService;

    @RequestMapping("/select")
    public List<Bookmanage> select(){
        List<Bookmanage> bookmanages = bookmanageService.selectBookmanage();
        return bookmanages;
    }


    @RequestMapping("/add")
    public Integer add(@RequestBody Bookmanage bookmanage){
        Integer integer = bookmanageService.addBookmanage(bookmanage);
        return integer;
    }
    @RequestMapping("/delete")
    public ResultEntity<Integer> delete(Long bId){
        Integer integer = bookmanageService.deleteBookmanage(bId);
        return ResultEntity.successWithoutData(integer);
    }

}
